package com.situ.analytics.service.client;

import com.situ.mall.analytics.spi.model.back.Sales;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Objects;

@FeignClient(value = "mall-gateway",contextId = "analytics-order-feign")
public interface SalesClient {

    @GetMapping("/api/orders/key-metrics")
    Sales getKeyMetrics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd")LocalDate startDate,
                        @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd")LocalDate endDate);

    @GetMapping("/api/orders/pay-type")
    List<Map<String, Object>> getPayType(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate startDate,
                                          @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd")LocalDate endDate);
//    [
//    {"name": "微信支付", "value": 52},
//    {"name": "支付宝", "value": 38},
//    {"name": "银联支付", "value": 8},
//    {"name": "其他支付", "value": 2}
//  ]
}
